import { defineStore } from "pinia";
import { ref } from "vue";

export const useInfoStore = defineStore("info", () => {
  const userInfo = ref({
    nickname: '加载中……',
    gender: '加载中……',
    birthday: '加载中……',
    location: '加载中……',
    description: '加载中……'
  });
  const privateInfo = ref({
    phone:'',
  })
  //2.定义修改用户信息的方法
  const setInfo = (newInfo)=>{
    userInfo.value = newInfo
  }
  //3.定义清空用户信息的方法
  const removeInfo = ()=>{
    userInfo.value={}
  }

  return { userInfo,privateInfo,setInfo,removeInfo}
}, {
  persist: true
})